import { RoutesAlias } from './routesAlias'
import { MenuListType } from '@/service/types/menu'

/**
 * 菜单列表、异步路由
 *
 * 支持两种模式:
 * 1. 前端静态配置 - 直接使用本文件中定义的路由配置
 * 2. 后端动态配置 - 后端返回菜单数据，前端解析生成路由
 *
 * 菜单标题（title）:
 * 可以是 i18n 的 key，也可以是字符串，比如：'用户列表'
 */
export const asyncRoutes: MenuListType[] = [
    {
        id: 1,
        name: 'Dashboard',
        path: '/dashboard',
        component: RoutesAlias.Home,
        meta: {
            title: 'menus.dashboard.title',
            icon: '&#xe721;',
            keepAlive: false
        },
        children: [
            {
                id: 11,
                path: 'console',
                name: 'Console',
                component: RoutesAlias.Dashboard,
                meta: {
                    title: 'menus.dashboard.console',
                    keepAlive: true
                }
            },
            {
                id: 12,
                path: 'analysis',
                name: 'Analysis',
                component: RoutesAlias.Analysis,
                meta: {
                    title: 'menus.dashboard.analysis',
                    keepAlive: true
                }
            },
            {
                id: 13,
                path: 'ecommerce',
                name: 'Ecommerce',
                component: RoutesAlias.Ecommerce,
                meta: {
                    title: 'menus.dashboard.ecommerce',
                    keepAlive: true
                }
            }
        ]
    },
    {
        id: 4,
        path: '/system',
        name: 'System',
        component: RoutesAlias.Home,
        meta: {
            title: 'menus.system.title',
            icon: '&#xe7b9;',
            keepAlive: false,
            // roles: ['R_SUPER', 'R_ADMIN']
        },
        children: [
            {
                id: 40,
                path: 'post',
                name: 'Post',
                component: RoutesAlias.Post,
                meta: {
                    title: 'menus.system.user',
                    keepAlive: true,
                }
            },
            {
                id: 41,
                path: 'user',
                name: 'User',
                component: RoutesAlias.User,
                meta: {
                    title: 'menus.system.user',
                    keepAlive: true,
                    // roles: ['R_SUPER', 'R_ADMIN']
                }
            },
            {
                id: 42,
                path: 'curd',
                name: 'Curd',
                component: RoutesAlias.Curd,
                meta: {
                    title: 'menus.system.role',
                    keepAlive: true,
                }
            },
            {
                id: 43,
                path: 'user-center',
                name: 'UserCenter',
                component: RoutesAlias.UserCenter,
                meta: {
                    title: 'menus.system.userCenter',
                    isHide: true,
                    keepAlive: true,
                    isHideTab: true
                }
            },
            {
                id: 442,
                path: 'menu2',
                name: 'Menu2',
                component: RoutesAlias.Menu2,
                meta: {
                    title: 'menus.system.menu',
                    keepAlive: true,
                }
            },
            {
                id: 44,
                path: 'menu',
                name: 'Menus',
                component: RoutesAlias.Menu,
                meta: {
                    title: 'menus.system.menu',
                    keepAlive: true,
                    // roles: ['R_SUPER'],
                    authList: [
                        {
                            id: 441,
                            title: '新增',
                            auth_mark: 'add'
                        },
                        {
                            id: 442,
                            title: '编辑',
                            auth_mark: 'edit'
                        },
                        {
                            id: 443,
                            title: '删除',
                            auth_mark: 'delete'
                        }
                    ]
                }
            }
        ]
    },
    {
        id: 6,
        path: '/result',
        name: 'Result',
        component: RoutesAlias.Home,
        meta: {
            title: 'menus.result.title',
            icon: '&#xe715;',
            keepAlive: false
        },
        children: [
            {
                id: 61,
                path: 'success',
                name: 'Success',
                component: RoutesAlias.Success,
                meta: {
                    title: 'menus.result.success',
                    keepAlive: true
                }
            },
            {
                id: 62,
                path: 'fail',
                name: 'Fail',
                component: RoutesAlias.Fail,
                meta: {
                    title: 'menus.result.fail',
                    keepAlive: true
                }
            },
            {
                id: 71,
                path: '403',
                name: '403',
                component: RoutesAlias.Exception403,
                meta: {
                    title: 'menus.exception.forbidden',
                    keepAlive: true
                }
            },
            {
                id: 72,
                path: '404',
                name: '404',
                component: RoutesAlias.Exception404,
                meta: {
                    title: 'menus.exception.notFound',
                    keepAlive: true
                }
            },
            {
                id: 73,
                path: '500',
                name: '500',
                component: RoutesAlias.Exception500,
                meta: {
                    title: 'menus.exception.serverError',
                    keepAlive: true
                }
            }
        ]
    }
]
